# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>
# Contributor: Kevin Azzam <aur at kevin.azz.am>
# Contributor: Ye Shu <shuye02 at outlook.com>

pkgname=onionshare
pkgver=2.6
pkgrel=2
pkgdesc='Share a file over Tor Hidden Services anonymously and securely'
url='https://github.com/onionshare/onionshare'
arch=('any')
license=('GPL3')
depends=('python' 'hicolor-icon-theme' 'tor' 'stem' 'python-requests' 'python-pysocks' 'python-flask' 'python-flask-httpauth' 'python-flask-socketio' 'python-gevent-websocket' 'python-psutil' 'python-pycryptodome' 'python-pyqt5' 'python-qrcode' 'python-unidecode' 'python-colorama' 'pyside2')
makedepends=('python-setuptools')
optdepends=(
  'python-nautilus: enable Nautilus right-click extension'
)
checkdepends=('python-pytest')
source=(https://github.com/onionshare/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz
        https://github.com/onionshare/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz.asc
)
sha512sums=('8764688c902aab1681eb3c00e6bbf779fa1f419d96852ecd091da3d5bd60d86759835da21d06510c2d7f4456e1f7fb0014d5df0b9533f736ae2ff596a53ec75e'
            'SKIP')
b2sums=('43ab80d23b1b169d94fd9511298f282f9b61f61026bdb46c14b4f02315564898e8de919ba3c1737e96343fe0ddc2bf6737fbcdf9ce3f4c5cff16b58381a86314'
        'SKIP')

validpgpkeys=('927F419D7EC82C2F149C1BD1403C2657CD994F73')

build() {
  cd ${pkgname}/cli
  python setup.py build
  cd ../desktop
  python setup.py build
}

check() {
  cd ${pkgname}
  pushd cli
  PYTHONPATH=".:${PYTHONPATH}" pytest tests/
  popd
  pushd desktop
  #PYTHONPATH="src:../cli:${PYTHONPATH}" pytest tests/
}

package() {
  cd ${pkgname}/cli
  python setup.py install --skip-build -O1 --root="${pkgdir}"
  cd ../desktop
  python setup.py install --skip-build -O1 --root="${pkgdir}"

  install -Dm 644 org.onionshare.OnionShare.desktop -t "${pkgdir}/usr/share/applications/"
  install -Dm 644 org.onionshare.OnionShare.svg -t "${pkgdir}/usr/share/icons/hicolor/scalable/apps/"
  install -Dm 644 org.onionshare.OnionShare.appdata.xml -t "${pkgdir}/usr/share/metainfo/"
}

# vim: ts=2 sw=2 et:
